const db = uniCloud.database();
module.exports = async function(options = {}) {
	const { key, value } = options;
	const token = this.getUniIdToken();
	if (!token || !key || typeof value == 'undefined') {
		throw new Error('非法访问');
	}
	await db.collection('uni-id-users').where({ token }).update({
		setting: {
			[key]: value
		}
	})
	return {
		code: 0,
		msg: '修改成功'
	}
}